package com.cos.blog.services.impl;


import com.cos.blog.core.dao.IBaseDao;
import com.cos.blog.core.service.BaseServiceImpl;
import com.cos.blog.dao.ICommentDao;
import com.cos.blog.dao.impl.CommentDaoImpl;
import com.cos.blog.entity.CommentEntity;
import com.cos.blog.services.ICommentService;
import com.cos.blog.vo.CommentVo;

import java.util.Date;
import java.util.List;

public class CommentServiceImpl extends BaseServiceImpl<CommentEntity> implements ICommentService {

    private ICommentDao commentDao = new CommentDaoImpl();

    @Override
    protected IBaseDao<CommentEntity> getBaseDao() {
        return commentDao;
    }

    @Override
    public boolean save(CommentEntity commentEntity) throws Exception {
        commentEntity.setCreateTime(new Date());
        commentEntity.setStatus(1);
        return getBaseDao().insert(commentEntity) > 0;
    }

    @Override
    public List<CommentVo> commentListByInvitataionId(Integer id) throws Exception{
        return commentDao.commentListByInvitataionId(id);
    }
}
